<template>
  <div class="container">
    <section class='f-mtp10'>
      <div class='u-title'>
        <h2>筛选查询</h2>
      </div>
      <div class='u-content u-filter f-ptp10'>
        <div class='u-filter-item'>
          <label for="">广告名称：</label>
          <el-input class='w-200' v-model="phone" placeholder="手机号"></el-input>
        </div>
        <div class='u-filter-item'>
          <label for="">广告位置：</label>
          <el-select class='w-200' v-model="vip" clearable placeholder="请选择">
            <el-option
              v-for="item in options"
              :key="item.value"
              :label="item.label"
              :value="item.value">
            </el-option>
          </el-select>
        </div>
        <el-button class='f-h40 f-mbt10' @click="search" type="primary">查询</el-button>
      </div>
    </section>

    <div class='f-mtp20'>
      <div class='u-title'>
        <h2>数据列表</h2>
        <router-link class='u-title-btn' to='/home/addAd'>添加广告</router-link>
      </div>
      <el-table
        :data="tableData"
        border
        style="width: 100%">
        <el-table-column prop="issueType" label="编号" width="120"></el-table-column>
        <el-table-column prop="phone" label="广告名称" width="180"></el-table-column>
        <el-table-column prop="region" label="广告位置" width="180"></el-table-column>
        <el-table-column prop="createTime" label="广告图片" width="180"></el-table-column>
        <el-table-column prop="createTime" label="发布时间" width="180"></el-table-column>
        <el-table-column prop="manage" label="下线/上线" width="120">
          <template slot-scope="scope">
            <el-switch
              @change="enableDepartment(scope.$index, scope.row)"
              style="display: block"
              v-model="scope.row.isUse"
              active-color="#1ABC9C"
              inactive-color="#e4e4e4">
            </el-switch>
          </template>
        </el-table-column>
        <el-table-column prop="manage" label="操作">
          <template slot-scope="scope">
            <span @click="handleEdit(scope.$index, scope.row)" class='s-c-green f-csp f-mrt10'>编辑</span>
            <span class='s-c-red f-csp'>删除</span>
          </template>
        </el-table-column>
      </el-table>
      <div>
        <el-pagination
          @size-change="handleSizeChange"
          @current-change="handleCurrentChange"
          :current-page.sync="currentPage1"
          :page-size="100"
          layout="total, prev, pager, next"
          :total="1000">
        </el-pagination>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: 'BannerManage',
  data() {
    return {
      phone: '',
      password: '',
      tableData: [
        {
          userCode: '2016-05-02',
          phone: '18098758888',
          name: '王小虎',
          idCard: '330326199908080606',
          accountBalance: 5000.00,
          vip: 1,
          createTime: '2018-12-30'
        }, {
          date: '2016-05-04',
          name: '王小虎',
          address: '上海市普陀区金沙江路 1517 弄'
        }, {
          date: '2016-05-01',
          name: '王小虎',
          address: '上海市普陀区金沙江路 1519 弄'
        }, {
          date: '2016-05-03',
          name: '王小虎',
          address: '上海市普陀区金沙江路 1516 弄'
        }
      ]
    }
  },
}
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
.top{
  /* display: flex; */
  overflow: hidden;
  padding: 10px 0;
}
.top-item{
  float: left;
  margin-right: 20px;
}
.w-120{
  width: 120px;
}
.w-200{
  width: 200px;
}
</style>
